<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="80px">
      <el-form-item label="学号/工号" prop="studentId">
        <el-input
          v-model="queryParams.studentId"
          placeholder="请输入学号/工号"
          clearable="true"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="部门" prop="department">
        <el-input
          v-model="queryParams.department"
          placeholder="请输入部门"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
      <el-form-item label="姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入姓名"
          clearable="true"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>


<!--      <el-form-item label="性别" prop="gender">
        <el-input
          v-model="queryParams.gender"
          placeholder="请输入性别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
<!--      <el-form-item label="电话" prop="phone">
        <el-input
          v-model="queryParams.phone"
          placeholder="请输入电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="身份证号" prop="idCard">
        <el-input
          v-model="queryParams.idCard"
          placeholder="请输入身份证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
     </el-form-item>-->
      <!--      <el-form-item label="指导教师" prop="teacherName">
             <el-input
               v-model="queryParams.teacherName"
               placeholder="请输入指导教师姓名"
               clearable
               @keyup.enter.native="handleQuery"
             />
           </el-form-item>
           <el-form-item label="教师工号" prop="teacherId">
             <el-input
               v-model="queryParams.teacherId"
               placeholder="请输入指导教师工号"
               clearable
               @keyup.enter.native="handleQuery"
             />
           </el-form-item>
           <el-form-item label="领用单位" prop="applicationDepartment">
             <el-input
               v-model="queryParams.applicationDepartment"
               placeholder="请输入领用单位"
               clearable
               @keyup.enter.native="handleQuery"
             />
           </el-form-item>-->
<!--      <el-form-item label="仪器类型" prop="equipmentType">
        <el-input
          v-model="queryParams.equipmentType"
          placeholder="请输入仪器类型"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="仪器名称" prop="instrumentName">
        <el-input
          v-model="queryParams.instrumentName"
          placeholder="请输入仪器名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
      <el-form-item label="设备类型" prop="equipmentType">
        <el-select
          v-model="queryParams.equipmentType"
          placeholder="请选择设备类型"
          @change="TypeChange"
          clearable="true"
        >
          <el-option
            v-for="dict in dict.type.yh_equip_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          ></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="设备名称" prop="instrumentName">
        <el-select
          v-model="queryParams.instrumentName"
          placeholder="设备名称"
          clearable="true"
        >
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="设备编号" prop="instrumentId" v-show="showSearch">
        <el-input
          v-model="queryParams.instrumentId"
          placeholder="请输入设备编号"
          clearable="true"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="型号" prop="modelNumber" v-show="showSearch">
        <el-input
          v-model="queryParams.modelNumber"
          placeholder="请输入设备型号"
          clearable="true"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="规格" prop="specification" v-show="showSearch">
        <el-input
          v-model="queryParams.specification"
          placeholder="请输入规格"
          clearable="true"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="审核状态" prop="auditStatus">
        <template>
          <el-select
            v-model="queryParams.auditStatus"
            placeholder="请选择审核状态"
            clearable
            >
            <el-option
              v-for="item in statusoptions"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </template>
      </el-form-item>

<!--      <el-form-item label="提交时间"  prop="beginTime,endTime"  >-->
<!--        <el-date-picker clearable-->
<!--                        v-model="queryParams.beginTime"-->
<!--                        type="date"-->
<!--                        value-format="yyyy-MM-dd"-->
<!--                        placeholder="开始日期"-->
<!--        >-->
<!--        </el-date-picker>-->
<!--        - -->
<!--        <el-date-picker clearable-->
<!--                        v-model="queryParams.endTime"-->
<!--                        type="date"-->
<!--                        value-format="yyyy-MM-dd"-->
<!--                        placeholder="结束日期"-->
<!--        >-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
      <el-form-item label="提交时间">
        <el-date-picker
          v-model="dateRange"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>



      <!--      <el-form-item label="型号" prop="modelNumber">
              <el-input
                v-model="queryParams.modelNumber"
                placeholder="请输入设备型号"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="规格" prop="specification">
              <el-input
                v-model="queryParams.specification"
                placeholder="请输入规格"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="单价" prop="unitPrice">
              <el-input
                v-model="queryParams.unitPrice"
                placeholder="请输入单价"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="分类编号" prop="classifyNumber">
              <el-input
                v-model="queryParams.classifyNumber"
                placeholder="请输入分类编号"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="购置日期" prop="purchaseDate">
              <el-date-picker
                clearable
                v-model="queryParams.purchaseDate"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择购置日期"
                style="width:93%"
              />

            </el-form-item>
            <el-form-item label="领用人" prop="receiver">
              <el-input
                v-model="queryParams.receiver"
                placeholder="请输入领用人"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>

             <el-form-item label="领用人工号" prop="receiverId">
              <el-input
                v-model="queryParams.receiverId"
                placeholder="请输入领用人工号"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="领用人姓名" prop="receiverName">
              <el-input
                v-model="queryParams.receiverName"
                placeholder="请输入领用人姓名"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>


            <el-form-item label="厂家" prop="manufacturers">
              <el-input
                v-model="queryParams.manufacturers"
                placeholder="请输入厂家"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="存放地点" prop="storageLocation">
              <el-input
                v-model="queryParams.storageLocation"
                placeholder="请输入存放地名称"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="入库日期" prop="storageDate">
              <el-date-picker
                clearable
                v-model="queryParams.storageDate"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择入库日期"
                style="width:93%"
              />
            </el-form-item>

            <el-form-item label="经费科目" prop="expenditureSubject">
              <el-input
                v-model="queryParams.expenditureSubject"
                placeholder="请输入经费科目"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="使用方向" prop="useDirection">
              <el-input
                v-model="queryParams.useDirection"
                placeholder="请输入使用方向"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="首次使用" prop="firstUse">
              <el-input
                v-model="queryParams.firstUse"
                placeholder="请输入首次使用"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="开始时间" prop="appointmentStart">
              <el-date-picker
                clearable
                v-model="queryParams.appointmentStart"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择开始使用时间"
                style="width:93%"
              />
            </el-form-item>
            <el-form-item label="结束时间" prop="appointmentEnd">
              <el-date-picker clearable
                v-model="queryParams.appointmentEnd"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择结束使用时间"
                              style="width:93%"
              />
            </el-form-item>
            <el-form-item label="提交时间" prop="sbumitTime">
              <el-date-picker clearable
                v-model="queryParams.sbumitTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择提交时间"
                              style="width:93%"
              />
            </el-form-item>
            <el-form-item label="教师审核" prop="teacherResult">
              <el-input
                v-model="queryParams.teacherResult"
                placeholder="请输入教师审核结果"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="领用人审核" prop="adminResult">
              <el-input
                v-model="queryParams.adminResult"
                placeholder="请输入领用人审核结果"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="教师审核时间" prop="teacherTime">
              <el-date-picker clearable
                v-model="queryParams.teacherTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择教师审核时间"
                              style="width:93%"
              />
            </el-form-item>
            <el-form-item label="管理审核时间" prop="adminTime">
              <el-date-picker clearable
                v-model="queryParams.adminTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择管理审核时间"
                              style="width:93%"
              />
            </el-form-item>
            <el-form-item label="用户ID" prop="userId">
              <el-input
                v-model="queryParams.userId"
                placeholder="请输入用户ID"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="部门ID" prop="deptId">
              <el-input
                v-model="queryParams.deptId"
                placeholder="请输入部门ID"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="创建者" prop="createBy">
              <el-input
                v-model="queryParams.createBy"
                placeholder="请输入创建者"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="创建时间" prop="createTime">
              <el-date-picker clearable
                v-model="queryParams.createTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择创建时间"
                              style="width:93%"
              />
            </el-form-item>
            <el-form-item label="更新者" prop="updateBy">
              <el-input
                v-model="queryParams.updateBy"
                placeholder="请输入更新者"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="更新时间" prop="updateTime">
              <el-date-picker clearable
                v-model="queryParams.updateTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择更新时间"
                              style="width:93%"
              />
            </el-form-item>-->
<!--      <el-form-item label="备注1" prop="note1">
        <el-input
          v-model="queryParams.note1"
          placeholder="请输入备注1"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注2" prop="note2">
        <el-input
          v-model="queryParams.note2"
          placeholder="请输入备注2"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注3" prop="note3">
        <el-input
          v-model="queryParams.note3"
          placeholder="请输入备注3"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注4" prop="note4">
        <el-input
          v-model="queryParams.note4"
          placeholder="请输入备注4"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注5" prop="note5">
        <el-input
          v-model="queryParams.note5"
          placeholder="请输入备注5"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注6" prop="note6">
        <el-input
          v-model="queryParams.note6"
          placeholder="请输入备注6"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注7" prop="note7">
        <el-input
          v-model="queryParams.note7"
          placeholder="请输入备注7"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注8" prop="note8">
        <el-input
          v-model="queryParams.note8"
          placeholder="请输入备注8"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注9" prop="note9">
        <el-input
          v-model="queryParams.note9"
          placeholder="请输入备注9"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注10" prop="note10">
        <el-input
          v-model="queryParams.note10"
          placeholder="请输入备注10"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
        <br/>
        <div style="text-align: right;">
        <el-button   type="primary" icon="el-icon-search" size="mini" @click="handleQuery" >搜索</el-button>

          <el-button
            type="warning"
            plain
            icon="el-icon-download"
            size="mini"
            @click="handleExport"
            v-hasPermi="['lck:appointment:export']"
          >导出</el-button>

        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        </div>
        <br/>
    </el-form>

   <el-row :gutter="10" class="mb8">
<!--     <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['project:appointment:add']"
        >新增</el-button>
      </el-col>

      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['project:appointment:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['project:appointment:remove']"
        >删除</el-button>
      </el-col>-->


<!--      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-upload2"
          size="mini"
          @click="handleImport"
          v-hasPermi="['project:appointment:import']"
        >导入
        </el-button>
      </el-col>-->


      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="appointmentList" @selection-change="handleSelectionChange"
              border
              :row-style="{height:'35px'}"
              :cell-style="{padding:'0px'}">
<!--      <el-table-column type="selection" width="55" align="center" />-->
<!--      <el-table-column label="ID" align="center" prop="id" />-->
      <el-table-column label="序号" align="center" :index="indexMethod" type="index"  />
      <el-table-column label="学号/工号" align="center" prop="studentId" width="120"/>
<!--      <el-table-column label="部门" align="center" prop="department" />-->
      <el-table-column label="姓名" align="center" prop="name" width="120"/>
<!--      <el-table-column label="性别" align="center" prop="gender" />-->
<!--      <el-table-column label="电话" align="center" prop="phone" />
      <el-table-column label="身份证号" align="center" prop="idCard" width="180"/>-->
<!--      <el-table-column label="指导教师姓名" align="center" prop="teacherName" width="180" />
      <el-table-column label="指导教师工号" align="center" prop="teacherId" width="180" />

      <el-table-column label="领用单位" align="center" prop="applicationDepartment" />-->
      <el-table-column label="设备编号" align="center" prop="instrumentId" width="120"/>
      <el-table-column label="设备类型" align="center" prop="equipmentType" width="130">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.yh_equip_type" :value="scope.row.equipmentType"/>
        </template>
      </el-table-column>
      <el-table-column label="设备名称" align="center" prop="instrumentName" />

      <el-table-column label="型号" align="center" prop="modelNumber" width="150"/>
      <el-table-column label="规格" align="center" prop="specification" width="150"/>
<!--      <el-table-column label="型号" align="center" prop="modelNumber" />
      <el-table-column label="规格" align="center" prop="specification" />
      <el-table-column label="单价" align="center" prop="unitPrice" />
      <el-table-column label="分类号" align="center" prop="classifyNumber" />
      <el-table-column label="购置日期" align="center" prop="purchaseDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.purchaseDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="领用人" align="center" prop="receiver" />
      <el-table-column label="领用人工号" align="center" prop="receiverId" />
      <el-table-column label="领用人姓名" align="center" prop="receiverName" />
      <el-table-column label="厂家" align="center" prop="manufacturers" />
      <el-table-column label="入库日期" align="center" prop="storageDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.storageDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="存放地名称" align="center" prop="storageLocation" width="150"/>
      <el-table-column label="经费科目" align="center" prop="expenditureSubject" />
      <el-table-column label="使用方向" align="center" prop="useDirection" />
      <el-table-column label="首次使用" align="center" prop="firstUse" />
      <el-table-column label="开始使用时间" align="center" prop="appointmentStart" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.appointmentStart, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="结束使用时间" align="center" prop="appointmentEnd" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.appointmentEnd, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>

      <el-table-column label="审核状态" align="center" prop="auditStatus" />
      <el-table-column label="教师审核结果" align="center" prop="teacherResult" width="180"/>
      <el-table-column label="领用人审核结果" align="center" prop="adminResult" width="180"/>
      <el-table-column label="教师审核时间" align="center" prop="teacherTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.teacherTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="管理审核时间" align="center" prop="adminTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.adminTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="用户ID" align="center" prop="userId" />
      <el-table-column label="部门ID" align="center" prop="deptId" />
      <el-table-column label="创建者" align="center" prop="createBy" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="更新者" align="center" prop="updateBy" />
      <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>-->
      <el-table-column label="提交时间" align="center" prop="sbumitTime" width="98">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.sbumitTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审核状态" align="center" prop="auditStatus" width="80">
        <template slot-scope="scope">
          <span v-if="scope.row.auditStatus==0">待审核</span>
          <span v-if="scope.row.auditStatus==1">审核通过</span>
          <span v-if="scope.row.auditStatus==2">审核未通过</span>
         <!-- <span v-if="scope.row.note1==1">预约取消</span>-->
        </template>
      </el-table-column>


<!--      <el-table-column label="备注1" align="center" prop="note1" />
      <el-table-column label="备注2" align="center" prop="note2" />
      <el-table-column label="备注3" align="center" prop="note3" />
      <el-table-column label="备注4" align="center" prop="note4" />
      <el-table-column label="备注5" align="center" prop="note5" />
      <el-table-column label="备注6" align="center" prop="note6" />
      <el-table-column label="备注7" align="center" prop="note7" />
      <el-table-column label="备注8" align="center" prop="note8" />
      <el-table-column label="备注9" align="center" prop="note9" />
      <el-table-column label="备注10" align="center" prop="note10" />-->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width"  width="100">
        <template slot-scope="scope">
<!--          <el-button
            size="mini"
            type="text"

            @click="handleUpdate(scope.row)"
            v-hasPermi="['project:appointment:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"

            @click="handleDelete(scope.row)"
            v-hasPermi="['project:appointment:remove']"
          >删除</el-button>-->

          <el-button
            size="mini"
            type="text"

            @click="handlelook(scope.row)"

          >详情</el-button>

        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改预约信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-container>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff;font-size: 18px;">预约信息</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-table-row>
              <el-col span="24">
                <el-form-item label="学号" prop="studentId">
                  <el-input v-model="form.studentId" placeholder="请输入学号" />
                </el-form-item>
              </el-col>
              <el-col span="24">
                <el-form-item label="部门" prop="department">
                  <el-input v-model="form.department" placeholder="请输入部门" />
                </el-form-item>
              </el-col>
              <el-col span="24">
                <el-form-item label="姓名" prop="name">
                  <el-input v-model="form.name" placeholder="请输入姓名" />
                </el-form-item>
              </el-col>

              <el-col span="24">
                <el-form-item label="电话" prop="phone">
                  <el-input v-model="form.phone" placeholder="请输入电话" />
                </el-form-item>
              </el-col>

              <el-col span="24">
                <el-form-item label="身份证号" prop="idCard">
                  <el-input v-model="form.idCard" placeholder="请输入身份证号" />
                </el-form-item>
              </el-col>
            </el-table-row>

            <el-col span="24">
              <el-form-item label="设备编号" prop="instrumentId">
                <el-input v-model="form.instrumentId" placeholder="请输入设备编号" />
              </el-form-item>
            </el-col>

            <el-col span="24">
              <el-form-item label="设备名称" prop="instrumentName">
                <el-input v-model="form.instrumentName" placeholder="请输入设备名称" />
              </el-form-item>
            </el-col>

          </el-main>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff;font-size: 18px;">附件信息</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-table-row>
              <el-col span="24">
                <el-form-item label="电子附件" prop="enclosure">
                  <file-upload   v-model="form.enclosure"/>
                </el-form-item>
              </el-col>
            </el-table-row>
          </el-main>
          <el-header>
            <el-divider content-position="left">
              <p style="color: #00afff;font-size: 18px;">备注信息</p>
            </el-divider>
          </el-header>
          <el-main>
            <el-table-row>
              <el-col span="24">
                <el-form-item label="审核信息" prop="auditStatus">
                  <el-input :rows="1" v-model="form.auditStatus" type="textarea" placeholder="请输入内容" />
                </el-form-item>
              </el-col>
            </el-table-row>
          </el-main>
        </el-container>
<!--        <el-form-item label="学号" prop="studentId">
          <el-input v-model="form.studentId" placeholder="请输入学号" />
        </el-form-item>
        <el-form-item label="部门" prop="department">
          <el-input v-model="form.department" placeholder="请输入部门" />
        </el-form-item>
        <el-form-item label="姓名" prop="name">
          <el-input v-model="form.name" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="性别" prop="gender">
          <el-input v-model="form.gender" placeholder="请输入性别" />
        </el-form-item>
        <el-form-item label="电话" prop="phone">
          <el-input v-model="form.phone" placeholder="请输入电话" />
        </el-form-item>
        <el-form-item label="身份证号" prop="idCard">
          <el-input v-model="form.idCard" placeholder="请输入身份证号" />
        </el-form-item>
        <el-form-item label="指导教师姓名" prop="teacherName">
          <el-input v-model="form.teacherName" placeholder="请输入指导教师姓名" />
        </el-form-item>
        <el-form-item label="指导教师工号" prop="teacherId">
          <el-input v-model="form.teacherId" placeholder="请输入指导教师工号" />
        </el-form-item>
        <el-form-item label="领用单位" prop="applicationDepartment">
          <el-input v-model="form.applicationDepartment" placeholder="请输入领用单位" />
        </el-form-item>
        <el-form-item label="设备编号" prop="instrumentId">
          <el-input v-model="form.instrumentId" placeholder="请输入设备编号" />
        </el-form-item>
        <el-form-item label="设备名称" prop="instrumentName">
          <el-input v-model="form.instrumentName" placeholder="请输入设备名称" />
        </el-form-item>
        <el-form-item label="型号" prop="modelNumber">
          <el-input v-model="form.modelNumber" placeholder="请输入型号" />
        </el-form-item>
        <el-form-item label="规格" prop="specification">
          <el-input v-model="form.specification" placeholder="请输入规格" />
        </el-form-item>
        <el-form-item label="单价" prop="unitPrice">
          <el-input v-model="form.unitPrice" placeholder="请输入单价" />
        </el-form-item>
        <el-form-item label="分类号" prop="classifyNumber">
          <el-input v-model="form.classifyNumber" placeholder="请输入分类号" />
        </el-form-item>
        <el-form-item label="购置日期" prop="purchaseDate">
          <el-date-picker clearable
            v-model="form.purchaseDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择购置日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="领用人" prop="receiver">
          <el-input v-model="form.receiver" placeholder="请输入领用人" />
        </el-form-item>
        <el-form-item label="领用人工号" prop="receiverId">
          <el-input v-model="form.receiverId" placeholder="请输入领用人工号" />
        </el-form-item>
        <el-form-item label="领用人姓名" prop="receiverName">
          <el-input v-model="form.receiverName" placeholder="请输入领用人姓名" />
        </el-form-item>
        <el-form-item label="厂家" prop="manufacturers">
          <el-input v-model="form.manufacturers" placeholder="请输入厂家" />
        </el-form-item>
        <el-form-item label="入库日期" prop="storageDate">
          <el-date-picker clearable
            v-model="form.storageDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择入库日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="存放地名称" prop="storageLocation">
          <el-input v-model="form.storageLocation" placeholder="请输入存放地名称" />
        </el-form-item>
        <el-form-item label="经费科目" prop="expenditureSubject">
          <el-input v-model="form.expenditureSubject" placeholder="请输入经费科目" />
        </el-form-item>
        <el-form-item label="使用方向" prop="useDirection">
          <el-input v-model="form.useDirection" placeholder="请输入使用方向" />
        </el-form-item>
        <el-form-item label="首次使用" prop="firstUse">
          <el-input v-model="form.firstUse" placeholder="请输入首次使用" />
        </el-form-item>
        <el-form-item label="开始使用时间" prop="appointmentStart">
          <el-date-picker clearable
            v-model="form.appointmentStart"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择开始使用时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="结束使用时间" prop="appointmentEnd">
          <el-date-picker clearable
            v-model="form.appointmentEnd"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择结束使用时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="提交时间" prop="sbumitTime">
          <el-date-picker clearable
            v-model="form.sbumitTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择提交时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="教师审核结果" prop="teacherResult">
          <el-input v-model="form.teacherResult" placeholder="请输入教师审核结果" />
        </el-form-item>
        <el-form-item label="领用人审核结果" prop="adminResult">
          <el-input v-model="form.adminResult" placeholder="请输入领用人审核结果" />
        </el-form-item>
        <el-form-item label="教师审核时间" prop="teacherTime">
          <el-date-picker clearable
            v-model="form.teacherTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择教师审核时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="管理审核时间" prop="adminTime">
          <el-date-picker clearable
            v-model="form.adminTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择管理审核时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="用户ID" prop="userId">
          <el-input v-model="form.userId" placeholder="请输入用户ID" />
        </el-form-item>
        <el-form-item label="部门ID" prop="deptId">
          <el-input v-model="form.deptId" placeholder="请输入部门ID" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注1" prop="note1">
          <el-input v-model="form.note1" placeholder="请输入备注1" />
        </el-form-item>
        <el-form-item label="备注2" prop="note2">
          <el-input v-model="form.note2" placeholder="请输入备注2" />
        </el-form-item>
        <el-form-item label="备注3" prop="note3">
          <el-input v-model="form.note3" placeholder="请输入备注3" />
        </el-form-item>
        <el-form-item label="备注4" prop="note4">
          <el-input v-model="form.note4" placeholder="请输入备注4" />
        </el-form-item>
        <el-form-item label="备注5" prop="note5">
          <el-input v-model="form.note5" placeholder="请输入备注5" />
        </el-form-item>
        <el-form-item label="备注6" prop="note6">
          <el-input v-model="form.note6" placeholder="请输入备注6" />
        </el-form-item>
        <el-form-item label="备注7" prop="note7">
          <el-input v-model="form.note7" placeholder="请输入备注7" />
        </el-form-item>
        <el-form-item label="备注8" prop="note8">
          <el-input v-model="form.note8" placeholder="请输入备注8" />
        </el-form-item>
        <el-form-item label="备注9" prop="note9">
          <el-input v-model="form.note9" placeholder="请输入备注9" />
        </el-form-item>
        <el-form-item label="备注10" prop="note10">
          <el-input v-model="form.note10" placeholder="请输入备注10" />
        </el-form-item>-->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>


    <!-- 用户导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px">
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>
        <div class="el-upload__tip" slot="tip">
          <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
          <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
        </div>
        <div class="el-upload__tip" style="color:red" slot="tip">提示：仅允许导入“xls”或“xlsx”格式文件！</div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<!--<style scoped>
.searchI {
  position: absolute;
  right: 0%;

}
</style>-->

<script>
import { listAppointment, getAppointment, delAppointment, addAppointment, updateAppointment,typeEquipment} from "@/api/module/lck/appointment";
import { getToken } from "@/utils/auth";
import { importTemplate } from "@/api/system/user";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";

export default {
  name: "Appointment",
  dicts:['yh_equip_type'],
  data() {
    return {
      statusoptions:[{
        value: '0',
        label: '待审核'
      }, {
        value: '1',
        label: '审核通过'
      }, {
        value: '2',
        label: '审核未通过'
      }],
      value: '',

      options:[],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: false,
      // 总条数
      total: 0,
      // 预约信息表格数据
      appointmentList: [],
      // 弹出层标题
      title: "",
      // 日期范围
      dateRange: [],
      // 默认排序
      defaultSort: {prop: 'operTime', order: 'descending'},
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        studentId: null,
        department: null,
        name: null,
        gender: null,
        phone: null,
        idCard: null,
        teacherName: null,
        teacherId: null,
        equipmentType: null,
        applicationDepartment: null,
        instrumentId: null,
        instrumentName: null,
        modelNumber: null,
        specification: null,
        unitPrice: null,
        classifyNumber: null,
        purchaseDate: null,
        receiverId: null,
        receiverName: null,
        manufacturers: null,
        storageDate: null,
        storageLocation: null,
        expenditureSubject: null,
        useDirection: null,
        firstUse: null,
        appointmentStart: null,
        appointmentEnd: null,
        sbumitTime: null,
        auditStatus: null,
        teacherResult: null,
        adminResult: null,
        teacherTime: null,
        adminTime: null,
        userId: null,
        deptId: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        beginTime: null,
        endTime: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: {Authorization: "Bearer " + getToken()},
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/project/lck/appointment/importData",
        fileList: []
      },

      // 表单参数
      form: {},
      // 表单校验
      rules: {
      },

      searchData: {
        inputValue1: '',
        inputValue2: '',
        date: ''
      }

    };
  },

  mounted() {
    this.getNowTime()
  },

  created() {
    const  appiontmentname = this.$route.query. appiontmentname;
    const firstname = this.$route.query.firstname;
    const  appiontmentlocal = this.$route.query. appiontmentlocal;


    const barcode = this.$route.query.barcode;
    console.log( appiontmentname+" appiontmentname");
    console.log(barcode+"barcode");
    if ( appiontmentname) {
      // 获取表详细信息
      this.queryParams.dataname= appiontmentname;
      this.queryParams.barcode=barcode;
      listAppiontment(this.queryParams).then(response => {
        this.appiontmentList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    }else if(firstname){
      // 获取表详细信息
      this.queryParams.firstpeople=firstname;
      this.queryParams.barcode=barcode;
      listAppiontment(this.queryParams).then(response => {
        this. appiontmentList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    }else if( appiontmentlocal){
      // 获取表详细信息
      this.queryParams.position= appiontmentlocal;
      this.queryParams.barcode=barcode;
      listAppiontment(this.queryParams).then(response => {
        this.appiontmentList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    }else if(barcode){
      // 获取表详细信息

      this.queryParams.barcode=barcode;
      listAppiontment(this.queryParams).then(response => {
        this.appiontmentList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    }
    else {
      this.getList();
    }
  },
  methods: {

    TypeChange(e){
      if(e){
        this.options=[],
          delete this.queryParams.instrumentName;    //删除第二个select绑定的属性
        typeEquipment(e).then(response => {
          this.data = response.data;
          for (let i = 0; i < this.data.length; i++) {
            this.options.push({
              value: this.data[i].instrumentName,
              label: this.data[i].instrumentName,
            })
          }
        });
      }
      else{
        this.options=[]
      }

    },

    getFilterData() {
      this.$emit('getFilterData', this.searchData)
    },
    getNowTime() {
      var now = new Date()
      var year = now.getFullYear() // 得到年份
      var month = now.getMonth() // 得到月份
      var date = now.getDate() // 得到日期
      month = month + 1
      month = month.toString().padStart(2, '0')
      date = date.toString().padStart(2, '0')
      var defaultDate = `${year}-${month}-${date}`
      this.$set(this.searchData, 'date', defaultDate)
    },

    //生成表头序号
    indexMethod(index) {
      index = (index + 1) + (this.queryParams.pageNum - 1) * this.queryParams.pageSize
      return index;
    },


    /** 查询预约信息列表 */
    getList() {
       console.log(this.dateRange)
      this.queryParams.beginTime=this.dateRange[0]
      this.queryParams.endTime=this.dateRange[1]
      console.log(this.queryParams.beginTime)
      console.log(this.queryParams.endTime)
      this.loading = true;
      listAppointment(this.queryParams).then(response => {
        this.appointmentList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        studentId: null,
        department: null,
        name: null,
        gender: null,
        phone: null,
        idCard: null,
        teacherName: null,
        teacherId: null,
        equipmentType: null,
        applicationDepartment: null,
        instrumentId: null,
        instrumentName: null,
        modelNumber: null,
        specification: null,
        unitPrice: null,
        classifyNumber: null,
        purchaseDate: null,
        receiver: null,
        manufacturers: null,
        storageDate: null,
        storageLocation: null,
        expenditureSubject: null,
        useDirection: null,
        firstUse: null,
        appointmentStart: null,
        appointmentEnd: null,
        submitTime: null,
        auditStatus: null,
        teacherResult: null,
        adminResult: null,
        teacherTime: null,
        adminTime: null,
        beginTime:null,
        endTime:null,
        userId: null,
        deptId: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.dateRange=[];
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加预约信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getAppointment(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改预约信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateAppointment(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addAppointment(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },

    // 文件提交处理
    submitUpload() {
      this.$refs.upload.submit();
    },

    /** 详情操作 */
    handlelook(row) {
      const id = row.id;
      // const tableName = row.tableName || this.tableNames[0];
      const params = {pageNum: this.queryParams.pageNum};

      this.$router.push({path: "/module/basedata", query: {id}});
    },

    /** 下载模板操作 */
    importTemplate() {
      this.download('/project/lck/appointment/importTemplate', {}, `appointment_template_${new Date().getTime()}.xlsx`)
    },
    /** 导入按钮操作 */
    handleImport() {
      this.upload.title = "导入";
      this.upload.open = true;
    },
// 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
// 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert(response.msg, "导入结果", {dangerouslyUseHTMLString: true});
      this.getList();
    },
// 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    },



    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除预约信息编号为"' + ids + '"的数据项？').then(function() {
        return delAppointment(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('/project/lck/appointment/export', {
        ...this.queryParams
      }, `appointment_${new Date().getTime()}.xlsx`)
    },
  }
};
</script>
<style>
/*.btn{
margin-left: 960px;
     }*/
</style>
